const nums = {
    '零': 0,
    '一': 1,
    '二': 2,
    '三': 3,
    '四': 4,
    '五': 5,
    '六': 6,
    '七': 7,
    '八': 8,
    '九': 9,
    '十': 10,
};
const config = {
    types: ['3d','ssq','kl8','7lc','pl3','pl5','dlt','7xc'],
    // 记录
    log: {
        't3d': {
        selector: 'tbody tr | array',
        schema: {
            qihao: 'td:nth-child(1)',
            riqi: 'td:nth-child(2)',
            red: 'td:nth-child(3)',
            moni: 'td:nth-child(4)',
            guanzhu: 'td:nth-child(5)',
            total: {
            selector: 'td:nth-child(6)',
            transform: (value) => Number(value.replace(/,/g,''))
            }
        }
        },
        'tssq': {
        selector: 'tbody tr | array',
        schema: {
            qihao: 'td:nth-child(1)',
            riqi: 'td:nth-child(2)',
            red: {
            selector: 'td:nth-child(3) .fred | array',
            },
            blue:{
            selector: 'td:nth-child(3) .fblue',
            },
            shunxu: 'td:nth-child(4)',
            total: {
            selector: 'td:nth-child(5)',
            transform: (value) => Number(value.replace(/,/g,''))
            },
            guncun: {
            selector: 'td:nth-child(6)',
            transform: (value) => Number(value.replace(/,/g,''))
            }
        }
        },
        'tkl8': {
        selector: 'tbody tr | array',
        schema: {
            qihao: 'td:nth-child(1)',
            riqi: 'td:nth-child(2)',
            red: {
            selector: 'td:nth-child(3) b | array',
            arrayTransform: (arr) => arr.join(', ')
            },
            total: {
            selector: 'td:nth-child(4)',
            transform: (value) => Number(value.replace(/,/g,''))
            },
            guncun: {
            selector: 'td:nth-child(5)',
            transform: (value) => Number(value.replace(/,/g,''))
            },
        }
        },
        't7lc': {
        selector: 'tbody tr | array',
        schema: {
            qihao: 'td:nth-child(1)',
            riqi: 'td:nth-child(2)',
            red: {
            selector: 'td:nth-child(3) .fred | array',
            },
            blue:{
            selector: 'td:nth-child(3) .fblue',
            },
            shunxu: 'td:nth-child(4)',
            total: {
            selector: 'td:nth-child(5)',
            transform: (value) => Number(value.replace(/,/g,''))
            }
        }
        },
        'tpl3': {
        selector: 'tbody tr | array',
        schema: {
            qihao: 'td:nth-child(1)',
            riqi: 'td:nth-child(2)',
            red: 'td:nth-child(3)',
            moni: 'td:nth-child(4)',
            kaijihao: 'td:nth-child(5)',
            guanzhu: 'td:nth-child(6)',
            total: {
            selector: 'td:nth-child(7)',
            transform: (value) => Number(value.replace(/,/g,''))
            }
        }
        },
        'tpl5': {
        selector: 'tbody tr | array',
        schema: {
            qihao: 'td:nth-child(1)',
            riqi: 'td:nth-child(2)',
            red: {
            selector: 'td:nth-child(3) .fred | array',
            },
            total: {
            selector: 'td:nth-child(4)',
            transform: (value) => Number(value.replace(/,/g,''))
            }
        }
        },
        'tdlt': {
        selector: 'tbody tr | array',
        schema: {
            qihao: 'td:nth-child(1)',
            riqi: 'td:nth-child(2)',
            red: {
            selector: 'td:nth-child(3) .fred | array',
            },
            blue:{
            selector: 'td:nth-child(3) .fblue',
            },
            shunxu: 'td:nth-child(4)',
            total: {
            selector: 'td:nth-child(5)',
            transform: (value) => Number(value.replace(/,/g,''))
            },
            guncun: {
            selector: 'td:nth-child(6)',
            transform: (value) => Number(value.replace(/,/g,''))
            },
        }
        },
        't7xc': {
        selector: 'tbody tr | array',
        schema: {
            qihao: 'td:nth-child(1)',
            riqi: 'td:nth-child(2)',
            red: {
            selector: 'td:nth-child(3) .fred | array',
            },
            blue:{
            selector: 'td:nth-child(3) .fblue',
            },
            total: {
            selector: 'td:nth-child(4)',
            transform: (value) => Number(value.replace(/,/g,''))
            },
            guncun: {
            selector: 'td:nth-child(5)',
            transform: (value) => Number(value.replace(/,/g,''))
            }
        }
        },
    },
    // 详情
    detail: {
        't3d': {
            schema: {
                touzhujine: {
                    selector: 'p',
                    transform: (value) => value.split('总额：')[1].split('元')[0].replace(/,/g,'')*1
                },
                data: {
                    selector: 'tbody tr | array',
                    schema: {
                        type: 'td:nth-child(1)',
                        shuliang: {
                            selector: 'td:nth-child(2)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jine: {
                            selector: 'td:nth-child(3)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jiangjin: 'td:nth-child(5)'
                        // guize: 'td:nth-child(4)',
                    }
                },
            }
        },
        'tssq': {
            schema: {
                touzhujine: {
                    selector: 'p.t',
                    transform: (value) => Number(value.split('， 奖池')[0].split('投注总额：')[1].split('元')[0].replace(/,/g,''))
                },
                jiangchijine: {
                    selector: 'p.t',
                    transform: (value) => Number(value.split('，返奖比')[0].split('奖池金额：')[1].split('元')[0].replace(/,/g,''))
                },
                fanjiangbi: {
                    selector: 'p.t',
                    transform: (value) => value.split('返奖比：')[1].split('。')[0]
                },
                shunxu: {
                    selector: 'p.b',
                    transform: (value) => value.split('。本期一等奖中奖地')[0].split('顺序：')[1]
                },
                fenbu: {
                    selector: 'p.b',
                    transform: (value) => value.split('本期一等奖中奖地： ')[1]
                },
                data: {
                    selector: 'tbody tr | array',
                    schema: {
                        type: 'td:nth-child(1)',
                        shuliang: {
                            selector: 'td:nth-child(2)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jine: {
                            selector: 'td:nth-child(3)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jiangjin: 'td:nth-child(5)'
                        // guize: 'td:nth-child(4)',
                    }
                },
            }
        },
        'tkl8': {
            schema: {
                touzhujine: {
                    selector: 'p.t',
                    transform: (value) => Number(value.split('， 奖池')[0].split('投注总额：')[1].split('元')[0].replace(/,/g,''))
                },
                jiangchijine: {
                    selector: 'p.t',
                    transform: (value) => Number(value.split('，返奖比')[0].split('奖池金额：')[1].split('元')[0].replace(/,/g,''))
                },
                fanjiangbi: {
                    selector: 'p.t',
                    transform: (value) => value.split('返奖比：')[1].split('。')[0]
                },
                shunxu: {
                    selector: 'p.b',
                    transform: (value) => value.split('出球顺序：')[1]
                },
                data: {
                    selector: 'tbody tr | array',
                    schema: {
                        type: 'td:nth-child(1)',
                        xuan: {
                            selector: 'td:nth-child(1)',
                            transform: (value) => `xuan${nums[value.split('选')[1].slice(0,1)]}`
                        },
                        shuliang: {
                            selector: 'td:nth-child(2)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jiangjin: {
                            selector: 'td:nth-child(3)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        // guize: 'td:nth-child(4)',
                    }
                },
            }
        },
        't7lc': {
            schema: {
                touzhujine: {
                    selector: 'p.t',
                    transform: (value) => Number(value.split('， 奖池')[0].split('投注总额：')[1].split('元')[0].replace(/,/g,''))
                },
                jiangchijine: {
                    selector: 'p.t',
                    transform: (value) => Number(value.split('，返奖比')[0].split('奖池金额：')[1].split('元')[0].replace(/,/g,''))
                },
                fanjiangbi: {
                    selector: 'p.t',
                    transform: (value) => value.split('返奖比：')[1].split('。')[0]
                },
                shunxu: {
                    selector: 'p.b',
                    transform: (value) => value.split('出球顺序：')[1].endsWith('。') ? value.split('出球顺序：')[1].slice(0,-1) : value.split('出球顺序：')[1]
                },
                data: {
                    selector: 'tbody tr | array',
                    schema: {
                        type: 'td:nth-child(1)',
                        shuliang: {
                            selector: 'td:nth-child(2)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jine: {
                            selector: 'td:nth-child(3)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jiangjin: 'td:nth-child(5)'
                        // guize: 'td:nth-child(4)',
                    }
                },
            }
        },
        'tpl3': {
            schema: {
                touzhujine: {
                    selector: 'p',
                    transform: (value) => value.split('返奖比')[0].split('总额：')[1].split('元')[0].replace(/,/g,'')*1
                },
                fanjiangbi: {
                    selector: 'p.t',
                    transform: (value) => value.split('返奖比：')[1].split('。')[0]
                },
                data: {
                    selector: 'tbody tr | array',
                    schema: {
                        type: 'td:nth-child(1)',
                        shuliang: {
                            selector: 'td:nth-child(2)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jine: {
                            selector: 'td:nth-child(3)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jiangjin: 'td:nth-child(5)'
                        // guize: 'td:nth-child(4)',
                    }
                },
            }
        },
        'tpl5': {
            schema: {
                touzhujine: {
                    selector: 'p',
                    transform: (value) => value.split('返奖比')[0].split('总额：')[1].split('元')[0].replace(/,/g,'')*1
                },
                fanjiangbi: {
                    selector: 'p.t',
                    transform: (value) => value.split('返奖比：')[1].split('。')[0]
                },
                data: {
                    selector: 'tbody tr | array',
                    schema: {
                        type: 'td:nth-child(1)',
                        shuliang: {
                            selector: 'td:nth-child(2)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jine: {
                            selector: 'td:nth-child(3)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jiangjin: 'td:nth-child(5)'
                        // guize: 'td:nth-child(4)',
                    }
                },
            }
        },
        'tdlt': {
            schema: {
                touzhujine: {
                    selector: 'p.t',
                    transform: (value) => Number(value.split('， 奖池')[0].split('投注总额：')[1].split('元')[0].replace(/,/g,''))
                },
                jiangchijine: {
                    selector: 'p.t',
                    transform: (value) => Number(value.split('，返奖比')[0].split('奖池金额：')[1].split('元')[0].replace(/,/g,''))
                },
                fanjiangbi: {
                    selector: 'p.t',
                    transform: (value) => value.split('返奖比：')[1].split('。')[0]
                },
                shunxu: {
                    selector: 'p.b',
                    transform: (value) => value.split('（本期使用')[0].split('顺序：')[1]
                },
                fenbu: {
                    selector: 'p.b',
                    transform: (value) => value.split('出自：')[1]
                },
                data: {
                    selector: 'table:nth-child(1) tbody tr | array',
                    schema: {
                        type: 'td:nth-child(1)',
                        shuliang: {
                            selector: 'td:nth-child(2)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jine: {
                            selector: 'td:nth-child(3)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jiangjin: 'td:nth-child(5)'
                        // guize: 'td:nth-child(4)',
                    }
                },
                zhuijia: {
                    selector: 'table:nth-child(2) tbody tr | array',
                    schema: {
                        type: 'td:nth-child(1)',
                        shuliang: 'td:nth-child(2)',
                        jiangjin: 'td:nth-child(3)',
                        jiangjin: 'td:nth-child(4)'
                    }
                },
            }
        },
        't7xc': {
            schema: {
                touzhujine: {
                    selector: 'p.t',
                    transform: (value) => Number(value.split('， 奖池')[0].split('投注总额：')[1].split('元')[0].replace(/,/g,''))
                },
                jiangchijine: {
                    selector: 'p.t',
                    transform: (value) => Number(value.split('，返奖比')[0].split('奖池金额：')[1].split('元')[0].replace(/,/g,''))
                },
                fanjiangbi: {
                    selector: 'p.t',
                    transform: (value) => value.split('返奖比：')[1].split('。')[0]
                },
                data: {
                    selector: 'tbody tr | array',
                    schema: {
                        type: 'td:nth-child(1)',
                        shuliang: {
                            selector: 'td:nth-child(2)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jine: {
                            selector: 'td:nth-child(3)',
                            transform: (value) => Number(value.replace(/,/g,''))
                        },
                        jiangjin: 'td:nth-child(5)'
                        // guize: 'td:nth-child(4)',
                    }
                },
            }
        },
    }
}

exports.config = config;